package com.archetypus.projectschedule.web.projects.cmd;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.archetypus.projectschedule.common.dto.projects.Project;
import com.archetypus.projectschedule.common.dto.projects.ProjectKey;
import com.archetypus.projectschedule.common.exceptions.ProjectSchedulerException;
import com.archetypus.projectschedule.web.common.cmd.ICommand;
import com.archetypus.projectschedule.web.projects.bd.IProjectBD;
import com.archetypus.projectschedule.web.projects.bd.ProjectBD;

public class FindProjectCmd implements ICommand {

	public void execute(HttpServletRequest request, HttpServletResponse response)throws ProjectSchedulerException {
		int projectId = Integer.parseInt(request.getParameter("project"));
		
		Project project = new Project();
		project.setProjectKey(new ProjectKey(projectId));
		
		IProjectBD projectBD = new ProjectBD();
		Project selectedProject = projectBD.findProject(project);
		
		request.setAttribute("project", selectedProject);

	}

}
